<?php if(!defined('BASEPATH'))exit('No direct script access allowed'); ?>
<?php $this->load->view('admin/global/header'); ?>
<?php $this->load->view('admin/global/left'); ?>
<table cellpadding="0" cellspacing="0">
    <tr>
        <td class="title"><?php if(isset($category)){echo lang('EDIT').': '.lang('CATEGORY');}else{echo lang('ADD').': '.lang('CATEGORY');} ?></td>
    </tr>
    <?php if(isset($denied)){ ?>
    <tr>
        <td class="bar">
            <div class="error"><?php echo lang('DENIED'); ?></div>
            <meta http-equiv="refresh" content="5; <?php echo base_url().ADMIN_PATH; ?>" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php if($success == true){ ?>
    <tr>
        <td class="bar">
            <div class="success"><?php echo lang('SUCCESS_UPDATED_DATA'); ?></div>
            <meta http-equiv="refresh" content="1" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php echo Modules::run('admin/bar_module/index', $buttons); ?>
    <tr>
        <td valign="top">
        <form name="frmPost" id="frmPost" method="post">
            <table class="form" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="label" style="padding-top:140px;"><span class="red">*</span> <?php echo lang('SECTION'); ?>:</td>
                    <td>
                        <select name="txtSection" class="select" size="5" style="height:300px;">
                            <?php for($i = 1; $i <= 5; $i++){ ?>
                            <option value="" disabled="disabled" style="color:#555;">
                            <?php if($i == 1){ ?>
                            <?php echo lang('PRODUCT'); ?>
                            <?php }elseif($i == 2){ ?>
                            <?php echo lang('ADS'); ?>
                            <?php }elseif($i == 3){ ?>
                            <?php echo lang('SHOP'); ?>
                            <?php }elseif($i == 4){ ?>
                            <?php echo lang('JOB_WORK'); ?>
                            <?php }else{ ?>
                            <?php echo lang('NEWS'); ?>
                            <?php } ?>
                            </option>
                            <?php foreach($sections as $section){ ?>
                            <?php if((int)$section->secType == $i){ ?>
                            <option value="<?php echo $section->secID; ?>" <?php if(isset($category) && (int)$category->catSection == (int)$section->secID){echo set_select('txtSection', $section->secID, true);}else{echo set_select('txtSection', $section->secID);} ?>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $section->secName; ?></option>
                            <?php } ?>
                            <?php } ?>
                            <?php } ?>
                        </select>
                        <?php echo form_error('txtSection'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><span class="red">*</span> <?php echo lang('CATEGORY'); ?>:</td>
                    <td>
                        <input type="text" name="txtName" class="input" value="<?php if(isset($category)){echo set_value('txtName', $category->catName);}else{echo set_value('txtName');} ?>" />
                        <?php echo form_error('txtName'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><?php echo lang('ORDER'); ?>:</td>
                    <td>
                        <input type="text" name="txtOrder" class="inputOrder" value="<?php if(isset($category)){echo set_value('txtOrder', $category->catOrder);}else{echo set_value('txtOrder');} ?>" />
                        <?php echo form_error('txtOrder'); ?>
                    </td>
                </tr>
                <tr>
                    <td class="label0"><?php echo lang('ACTIVE'); ?>:</td>
                    <td>
                        <input type="checkbox" name="txtStatus" class="checkbox" value="1" <?php if(isset($category) && (int)$category->catStatus == 1){echo set_checkbox('txtStatus', 1, true);}else{echo set_checkbox('txtStatus', 1);} ?> />
                    </td>
                </tr>
            </table>
        </form>
        </td>
    </tr>
    <?php } ?>
    <?php } ?>
</table>
<?php $this->load->view('admin/global/right'); ?>
<?php $this->load->view('admin/global/footer'); ?>